package saer.send.now;

import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level;
import java.util.logging.Logger;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import saer.send.now.channel.Channel;

public class Initialize implements ServletContextListener {

    public static final String  CHANNEL_STORE = "ChannelStore";

    private static final Logger log           = Logger.getLogger(Channel.class.getName());

    @Override
    public void contextDestroyed(ServletContextEvent event) {
        log.log(Level.INFO, "SendNow context destroy");
    }

    @Override
    public void contextInitialized(ServletContextEvent event) {
        log.log(Level.INFO, "SendNow context init");
        event.getServletContext().setAttribute(CHANNEL_STORE, new ConcurrentHashMap<String, Channel>());
    }
}
